<?php
/**
 * Created by PhpStorm.
 * User: DINGHAO
 * Date: 2018/11/8
 * Time: 9:15
 */
namespace Admin\Controller;
use Think\Controller;
class CommonController extends Controller{
    //构造方法
    public function _initialize()
    {
        //判断是否登录
        if (empty(session('username'))) {
             //如果没有登录跳转到登录页面
            $url=U('Login/index');
            echo "<script>
            top.location.href='$url'
            </script>";exit;
        }
    }
}